#include "../comm.h"
class Solution {
public:
    long long numberOfWeeks(vector<int>& milestones) {
        long long sum = 0;
        int mx = 0;
        for(int i = 0; i < milestones.size(); ++i)
            mx = max(mx, milestones[i]), sum += milestones[i];
        long long res = sum - mx;
        if(res + 1 >= mx)
            return sum;
        else
            return res * 2 + 1;
    }
};